package cn.acewill.yxd.yunxundian.utils;

import android.app.Activity;
import android.app.Dialog;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import cn.acewill.yxd.yunxundian.R;

/**
 * Created by XXX on 2017/6/21.
 */

public class TopDialogUtils {

    public static void showTopDialog(Activity activity, Dialog dialog, View view , int h){
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(view);
        dialog.setCanceledOnTouchOutside(true);
        Window dialogWindow=dialog.getWindow();
        dialogWindow.setWindowAnimations(R.style.AnimTop);
        WindowManager.LayoutParams lp=dialogWindow.getAttributes();
        lp.gravity = Gravity.TOP;
        lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度持平
        lp.height = activity.getWindowManager().getDefaultDisplay().getHeight() * h/ 10;
        dialogWindow.setAttributes(lp);

    }
}
